From: Giovanni Campagna Date: Thu, 14 Feb 2013 16:12:26 +0000 (+0100) Subject: MessageTray: don't clear the banner text when adding to the body X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~4814 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=07676d483d1dce46154f36e3cebc54c1e9ff8d86;p=gnome-shell.git MessageTray: don't clear the banner text when adding to the body ScreenShield uses Notification.bannerBodyText to fill the body of detailed notifications, so use a separate boolean property to indicate it was already added to the body. https://bugzilla.gnome.org/show_bug.cgi?id=693822 --- diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 4c8c13325..f87848110 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -359,6 +359,7 @@ const Notification = new Lang.Class({ this._customContent = false; this.bannerBodyText = null; this.bannerBodyMarkup = false; + this._bannerBodyAdded = false; this._titleFitsInBannerMode = true; this._titleDirection = Clutter.TextDirection.DEFAULT; this._spacing = 0; @@ -521,6 +522,7 @@ const Notification = new Lang.Class({ // not fitting fully in the single-line mode. this.bannerBodyText = this._customContent ? null : banner; this.bannerBodyMarkup = params.bannerMarkup; + this._bannerBodyAdded = false; banner = banner ? banner.replace(/\n/g, ' ') : ''; @@ -602,10 +604,9 @@ const Notification = new Lang.Class({ }, _addBannerBody: function() { - if (this.bannerBodyText) { - let text = this.bannerBodyText; - this.bannerBodyText = null; - this.addBody(text, this.bannerBodyMarkup); + if (this.bannerBodyText && !this._bannerBodyAdded) { + this._bannerBodyAdded = true; + this.addBody(this.bannerBodyText, this.bannerBodyMarkup); } }, @@ -897,7 +898,7 @@ const Notification = new Lang.Class({ }, _canExpandContent: function() { - return this.bannerBodyText || + return (this.bannerBodyText && !this._bannerBodyAdded) || (!this._titleFitsInBannerMode && !this._table.has_style_class_name('multi-line-notification')); },